Daniel Lyons' Notes

Parallel Coding Agents with Container Use and Git Worktree

Description

AI ENGINEER ROADMAP [ 🚀 learn AI Engineering in 2025 ]► https://zazencodes.com/NEWSLETTER [ 🍰 weekly video release email ]► https://zazencodes.com/newslett...

Notes

00:00 Introduction to Parallel Agents

  • Parallel agents represent the future of generative coding
  • Three workflows for safely developing with parallel agents in a single codebase
  • Demonstrations use Claude Code but applicable to other coding agents (Cursor, Gemini)
  • Workflows build in sophistication with container use as the most powerful approach
  • 00:30: Container use is an open-source project from Dagger, created by Docker's founders

00:51 Workflow 1: Copy Folders Method

Overview

  • Simplest approach: copy the project folder to separate directories for each agent
  • Each agent works on a different feature implementation in parallel

Implementation

  • 01:56: Copy React project to agent A and agent B folders
  • 02:01: Drawback: Copying corrupts node_modules paths, requiring reinstall with npm rm -r node_modules and npm i
  • Run npm run dev on both agents simultaneously

Comparison and Merging

  • 04:00: Compare different feature implementations from each agent
  • 04:20: Select preferred version (agent B in demo)
  • 04:40: Commit changes to Git and push to remote
  • 05:02: Pull changes into main project and clean up agent folders

05:24 Workflow 2: Git Worktree Method

Advantages Over Copy Folders

  • Faster: creates branches and workspaces instantly without full folder duplication
  • Uses Git best practices by creating separate branches for each agent
  • Avoids copying entire file structures

Setup

  • 05:40: Use git worktree add -b [branch-name] [folder-name] to create agent workspaces
  • Automatically creates feature branches (agent A and agent B)
  • Each agent works on their respective Git branch

Development Process

  • 06:42: Navigate into each agent folder with full Git environment access
  • 06:52: Still need to run npm install in each workspace (downside)
  • Run dev servers on different ports (agent A on 8080, agent B on 8081)
  • 07:30: Build different feature variations (e.g., click-through rate focus vs. aesthetics focus)

Merging Changes

  • 08:47: Commit changes in chosen agent workspace
  • 09:15: Use git merge to bring feature into main branch
  • 10:40: Remove worktrees with git worktree remove [folder]
  • Force removal with -f flag if uncommitted changes exist
  • Clean up branches with git branch -d

11:58 Workflow 3: Container Use with Dagger

Introduction and Installation

  • Most powerful approach for parallel agent development
  • Built by creators of Docker, newly launched open-source project
  • 12:07: Install via brew install dagger-io/dagger/container-use
  • 12:15: Check version with container-use version
  • 12:22: List environments with container-use list, watch with container-use watch

MCP Server Integration

  • 12:41: Add container-use as MCP server to Claude for local project
  • 13:02: Configure with claude.md file containing Dagger agent rules
  • Instructs Claude Code to properly use container-use integration

Quick Start Demo

  • 14:17: Create Python hello world script and update readme
  • 14:29: container-use environment create spawns containerized workspace
  • 15:00: Work happens in isolated container, files don't appear locally until checkout
  • 15:31: container-use checkout [environment-name] pulls changes to local directory
  • Creates corresponding Git branch to track all work
  • 15:57: All changes are automatically committed with messages
  • 16:14: container-use merge brings changes to main branch
  • 16:50: container-use delete removes environment after merge

Real-World Multi-Agent Demo

  • 17:39: Open same project in four different terminal panes
  • Run Claude Code in parallel with --allowed-tools flag to skip confirmations
  • 18:19: Run three simultaneous redesign tasks:
    • Redesign website with fantasy RPG style theme
    • Redesign website with Barbie theme
    • Redesign website with super minimal feel
  • 18:35: Each task receives unique environment ID with separate containers
  • All agents work in isolation without stepping on each other

Viewing and Comparing Results

  • 19:14: container-use diff [environment-name] shows all changes made
  • 19:31: container-use checkout [environment-name] switches to each variant
  • Run npm run dev to preview each redesign locally
  • 20:35: Review different theme implementations and select preferred version
  • Each environment has complete Git history with all commits

Deployment

  • 21:20: git checkout main and container-use merge to integrate chosen version
  • 22:57: git push automatically triggers deployment pipeline (AWS in demo)

Key Advantages

  • 17:25: Requires Docker running on system
  • Complete isolation: no dependency conflicts between parallel agents
  • Automatic Git commits with descriptive messages
  • Simplified workflow compared to git worktree
  • No manual npm install needed per agent
  • Branch creation and cleanup automated

23:30 Conclusion and Future Outlook

  • Parallel agents represent the future of AI code generation
  • Benefits demonstrated: quick feature iteration, version comparison, clean selection
  • Container use workflow will only get easier with future updates
  • Dagger created by Docker founders, positioned as the standard for parallel agent workflows
  • Call to action: like video, subscribe, and try container-use implementation
Parallel Coding Agents with Container Use and Git Worktree
Interactive graph
On this page
Description
Notes
00:00 Introduction to Parallel Agents
00:51 Workflow 1: Copy Folders Method
Overview
Implementation
Comparison and Merging
05:24 Workflow 2: Git Worktree Method
Advantages Over Copy Folders
Setup
Development Process
Merging Changes
11:58 Workflow 3: Container Use with Dagger
Introduction and Installation
MCP Server Integration
Quick Start Demo
Real-World Multi-Agent Demo
Viewing and Comparing Results
Deployment
Key Advantages
23:30 Conclusion and Future Outlook